package com.tuoyu.peopletest.view.pop;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.lxj.xpopup.core.CenterPopupView;
import com.tuoyu.peopletest.R;
import com.tuoyu.peopletest.scinterface.OnBtnListener;
import com.tuoyu.peopletest.utils.SCUIUtils;

import androidx.annotation.NonNull;

/**
 * 结果通知弹窗
 */
public class QueryPop extends CenterPopupView {

    private Object hint;

    public QueryPop(@NonNull Context context, Object hint) {
        super(context);
        this.hint = hint;

    }

    @Override
    protected int getImplLayoutId() {

        return R.layout.pop_query;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        TextView tvBtnSure = findViewById(R.id.tv_btn_sure);
        TextView tvBtnCancle = findViewById(R.id.tv_btn_cancle);
        TextView tvHint = findViewById(R.id.tv_hint);
        SCUIUtils.setTextStr(tvHint,hint);

        tvBtnSure.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if(listener!=null){
                    listener.onLeft();
                }
            }
        });

        tvBtnCancle.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if(listener!=null){
                    listener.onRight();
                }
            }
        });
    }
    private OnBtnListener listener;
    public void setBtnListener(OnBtnListener listener){
       this.listener = listener;
    }
}
